<template>
  <p-modal
    :title="title"
    :width="width"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <p-spin :spinning="confirmLoading">
      <p-form-model :model="form" ref="formRules" :rules="rules">
        <p-row>
          <p-col :span="24">
            <p-form-model-item
              label="容器码"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <p-input
                placeholder="请输入容器码"
                v-model="form.barCode"
                readOnly
              ></p-input>
            </p-form-model-item>
          </p-col>
          <p-col :span="24">
            <p-form-model-item
              label="产品编码"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <p-input
                placeholder="请输入产品编码"
                v-model="form.productCode"
                readOnly
              ></p-input>
            </p-form-model-item>
          </p-col>
          <p-col :span="24">
            <p-form-model-item
              label="产品名称"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <p-input
                placeholder="请输入产品名称"
                v-model="form.productName"
                readOnly
              ></p-input>
            </p-form-model-item>
          </p-col>
          <p-col :span="24">
            <p-form-model-item
              label="产品数量"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <p-input
                placeholder="请输入产品数量"
                v-model="form.productQty"
                readOnly
              ></p-input>
            </p-form-model-item>
          </p-col>
          <p-col :span="24">
            <p-form-model-item
              label="老化标准时长"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
            >
              <p-input
                placeholder="请输入老化标准时长"
                v-model="form.standarAgingTime"
                readOnly
              ></p-input>
            </p-form-model-item>
          </p-col>
          <p-col :span="24">
            <p-form-model-item
              label="本次老化时长"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="newTime"
            >
              <p-input
                placeholder="请输入本次老化时长"
                v-model="form.newTime"
              ></p-input>
            </p-form-model-item>
          </p-col>
        </p-row>
      </p-form-model>
    </p-spin>
  </p-modal>
</template>

<script>
import { httpAction, putAction, api } from "@/api/manage";
import { SubmitOnchangMixin } from "@/mixins/SubmitOnchangMixin";
import pick from "lodash.pick";
import { validateDuplicateValue } from "@/utils/util";
export default {
  name: "",
  mixins: [SubmitOnchangMixin],
  data() {
    return {
      form: {
        barCode: "", //容器码
        productCode: "", //产品编码
        productName: "", //产品名称
        standarAgingTime: "", //标准老化时长
        newTime: "", //新老化时间
        productQty: "", //产品数量
      },
      width: 800,
      visible: false,
      confirmLoading: false,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      url: {
        list: "/basic-business/auto/baCpinfoMain/queryMtypeList", //获得产品类别
      },
      rules: {},
    };
  },
  methods: {
    edit(record) {
      this.visible = true;
      console.log(record);
      this.form = Object.assign({}, record);
    },
    close() {
      this.visible = false;
    },
    handleOk() {
      if (this.form.newTime) {
        this.$message.success("例外设置成功");
        this.visible = false;
      } else {
        this.$message.warning("未设置新的老化时长");
        this.visible = false;
      }
    },
    handleCancel() {
      this.close();
    },
  },
};
</script>

<style lang='scss' scoped>
</style>
